<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>金币录入管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
 		/* $(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});*/ 
		  //审核通过
		  function check () {  
			var goldcoinbranchId=$("#branchid").val();
			var id=$("#goldcoinid").val();		
			var  applystaffid =$("#applystaffid").val();	
			var   goldcoinactivity=$("#goldcoinactivity").val();
			var   canusecash=$("#canusecash").val();
			var   freezecash=$("#freezecash").val();
			var   goldcoindistributiontotalnumber=$("#goldcoindistributiontotalnumber").val();
  		    $.ajax({  
			        type:"POST",  
			         url: "${ctx}/goldinput/goldcoin/check",
			         dataType:'json', 
			         data:{"id":id,"applystaffid":applystaffid,"goldcoinactivity":goldcoinactivity,"canusecash":canusecash,"freezecash":freezecash, "goldcoindistributiontotalnumber": goldcoindistributiontotalnumber    },
			         async:false,  
			         success:function(result){
			        	 if(result.code=='01'){
			        	   alert(result.msg);	 
			        	 }else if(result.code='02'){
			        		 alert("审核通过成功") 
			        	 window.location.href="${ctx}/goldinput/goldcoin/list?branchId="+goldcoinbranchId;}
				        },
			         error:function(data){
			        	 alert("出错了,！！");
			        	 },   
		    });	
 	    }
		//审核打回
		 function back () { 
			 var goldcoinbranchId=$("#branchid").val();
			var id=$("#goldcoinid").val();		
			var  applystaffid =$("#applystaffid").val();		
			 $.ajax({  
			        type:"POST",  
			         url: "${ctx}/goldinput/goldcoin/checkBack",
			         dataType:'json', 
			         data:{"id":id,"applystaffid":applystaffid},
			         async:false,  
			         success:function(result){
			        	 if(result.code=='01'){
				        	   alert(result.msg);	 
				        	 }else if(result.code='02'){
				        	  alert("审核打回成功")	 
				        	 window.location.href="${ctx}/goldinput/goldcoin/list?branchId="+goldcoinbranchId;}      	 	  
				        },
			         error:function(data){
			        	 alert("出错了,！！");
			        	 },   
		    });	
 	    }

			

	</script>
</head>
<body>	
    
		<c:if  test="${'01' eq goldcoinWapper.status}">
                  <li>金币管理->金币审核</li>
		</c:if>
		<c:if  test="${'02' eq goldcoinWapper.status}">
                  <li>金币管理->金币详情</li>
		</c:if>
		<c:if  test="${'05' eq goldcoinWapper.status}">
                  <li>金币管理->金币详情</li>
		</c:if>
	<form:form id="inputForm" modelAttribute="goldcoinWapper"  class="form-horizontal">	
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label"  >名称：</label>
			<div class="controls">
			    <form:input path="goldcoinid" htmlEscape="false" maxlength="80" id="goldcoinid"  style="display:none"  class="input-xlarge required"/>
				<form:input path="applystaffid" htmlEscape="false" maxlength="80" id="applystaffid"  style="display:none"  class="input-xlarge required"/>
				<form:input path="goldcoinactivity" htmlEscape="false" maxlength="80" id="goldcoinactivity"  style="display:none"  class="input-xlarge required"/>
				<form:input path="canusecash"  htmlEscape="false" maxlength="80" id="canusecash"  style="display:none"  class="input-xlarge required"/>
				<form:input path="freezecash" htmlEscape="false" maxlength="80" id="freezecash"  style="display:none"  class="input-xlarge required"/>
				<form:input path="goldcoindistributiontotalnumber" htmlEscape="false" maxlength="80" id="goldcoindistributiontotalnumber"  style="display:none"  class="input-xlarge required"/>
				<form:input path="branchid" htmlEscape="false" maxlength="80" id="branchid"  style="display:none"  class="input-xlarge required"/>
				<form:input path="goldcoinname" htmlEscape="false" maxlength="80" readonly= "true"  class="input-xlarge required"/>			
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">标识：</label>
			<div class="controls">
				<form:input path="goldcoinmark" htmlEscape="false" id="goldcoinmark" readonly= "true"  maxlength="50" class="input-xlarge required"    onblur="markValidate()"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">金币所属活动：</label>
			<div class="controls">
			<form:input path="activityname" htmlEscape="false" id="activityname" readonly= "true" maxlength="50" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">领取时间：</label>
			<div class="controls">
				<input name="goldcoincollectionstart" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${goldcoinWapper.goldcoincollectionstart}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					/>
			至
				<input name="goldcoincollectionend" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${goldcoinWapper.goldcoincollectionend}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">限领个数：</label>
			<div class="controls">
				<form:input path="goldcoinlimitnumber" htmlEscape="false" maxlength="8" readonly= "true"   class="input-small "/> 单位：个
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">发行总个数：</label>
			<div class="controls">
				<form:input path="goldcoindistributiontotalnumber" htmlEscape="false" readonly= "true"   maxlength="8" class="input-small required" /> 单位：个
			    <span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">金币有限期类型</label>
			<div class="controls">
		   <c:if
				  test="${'01' eq goldcoinWapper.goldcoinvaliditystyle}">
				  固定时间段
			</c:if>	
			<c:if
				  test="${'02' eq goldcoinWapper.goldcoinvaliditystyle}">
				  按季度计算有效期
			</c:if>	
			<c:if
				  test="${'03' eq goldcoinWapper.goldcoinvaliditystyle}">
				  有效天数
			</c:if>	
				<span class="help-inline"><font color="red">*</font> </span>
		</div>
		</div>
		<div class="control-group"  >
			<label class="control-label">金币有效期：</label>
			<div class="controls" >
				<c:if
				  test="${'01' eq goldcoinWapper.goldcoinvaliditystyle}">
				  <fmt:formatDate value="${goldcoinWapper.goldcoinvaliditystart}" pattern="yyyy-MM-dd HH:mm:ss"/> 至      <fmt:formatDate value="${goldcoinWapper.goldcoinvalidityend}" pattern="yyyy-MM-dd HH:mm:ss"/> </c:if>	
			<c:if
				  test="${'02' eq goldcoinWapper.goldcoinvaliditystyle}">
				  <fmt:formatDate value="${goldcoinWapper.goldcoincollectionstart}" pattern="yyyy-MM-dd HH:mm:ss"/> 至      <fmt:formatDate value="${goldcoinWapper.goldcoinvalidityend}" pattern="yyyy-MM-dd HH:mm:ss"/> </c:if>	
			<c:if
				  test="${'03' eq goldcoinWapper.goldcoinvaliditystyle}">
				<fmt:formatDate value="${goldcoinWapper.goldcoincollectionstart}" pattern="yyyy-MM-dd HH:mm:ss"/> 至   
				<fmt:formatDate value="${goldcoinWapper.goldcoininvalidity}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</c:if>
			</div>
		</div>	
		<div class="control-group">
			<label class="control-label">描述：</label>
			<div class="controls">
				<form:input path="description" readonly= "true"  htmlEscape="false" maxlength="200" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
   
   	<c:if
				  test="${'01' eq goldcoinWapper.status}">
				 
		<div class="form-actions">
			<shiro:hasPermission name="goldinput:goldcoin:edit">
			 <input type="button" id="btn_save1" value="审核通过"
				style="width: 90px; height: 40px; margin-top: 00px; background-color: #5599FF; color: #FFFFFF"
				onclick="check()" />
				
			<input type="button" id="btn_save1" value="打回"
				style="width: 90px; height: 40px; margin-top: 00px; background-color: #5599FF; color: #FFFFFF"
				onclick="back()" />
			</shiro:hasPermission>
			
		</div> 
				
     </c:if>
   
   
   
	
	</form:form>
</body>
</html>